package com.digital.welcome.controller;


import com.digital.welcome.annotation.OperationLog;
import com.digital.welcome.service.MajorClassService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 韩
 */
@RestController
@RequestMapping("/major-class")
public class MajorClassController {


    @Autowired
    private MajorClassService majorClassService;

    @ApiOperation(value = "获取所有班级")
    @RequestMapping(value = "/get-all", method = RequestMethod.GET)
    public String getAllMajorClass() {
        return majorClassService.getMajorList();
    }

    @OperationLog()
    @ApiOperation(value = "新增班级")
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    public String insertMajorClass(String majorClass, String majorClassName) {
        return majorClassService.inserMajor(majorClass, majorClassName);
    }

    @OperationLog()
    @ApiOperation(value = "删除班级")
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public String deleteMajorClass(String majorClass, String majorClassName) {
        return majorClassService.deleteMajor(majorClass, majorClassName);
    }


}
